package mytest.ssw.www.myandroidproject.activity;

import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.CheckBox;

import mytest.ssw.www.myandroidproject.R;
import mytest.ssw.www.myandroidproject.mydate.CheckUpdateInfo;
import mytest.ssw.www.myandroidproject.view.ClickItimView;

public class SettingActivity extends AppCompatActivity {

    ClickItimView clickItimView;
    private SharedPreferences sp;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_setting);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
        clickItimView=(ClickItimView)findViewById(R.id.clickitimView);
        clickItimView.setOnClickListener(new myclickitemonclick());

        sp = getSharedPreferences("updatecinfig",MODE_PRIVATE);
        if (sp.getBoolean("update",true))
           clickItimView.notifview(true);
        else
        {
            clickItimView.notifview(false);
        }
    }
class myclickitemonclick implements View.OnClickListener {

    @Override
    public void onClick(View v) {
        SharedPreferences.Editor editor=sp.edit();
        editor.putBoolean("update", clickItimView.changecheck());
        editor.commit();
    }
}


}
